package com.suray.attendance.model.enums.erp;

/**
 * Description: 维护领料出库单的单据类型对应枚举类
 * Author: linyu
 * Date: 2023/11/17
 */
public enum IssueReceiptDocTypeCodeEnum {

    安徽生产生产领料单("5640"),
    安徽生产重工工单领料出库单("5641"),
    安徽生产委外领料单("5642"),
    安徽生产自动扣料单("5643"),
    安徽机电生产领料单("5680"),
    安徽机电重工工单领料出库单("56810"),
    安徽机电委外领料单("5682"),
    安徽机电自动扣料单("5683");


    private String docTypeCode;

    IssueReceiptDocTypeCodeEnum(String docTypeCode) {
        this.docTypeCode = docTypeCode;
    }

    public String getDocTypeCode() {
        return docTypeCode;
    }

    public void setDocTypeCode(String docTypeCode) {
        this.docTypeCode = docTypeCode;
    }

    public static String getDocTypeCodeByDocTypeName(String docTypeName) {
        IssueReceiptDocTypeCodeEnum arrObj[] = IssueReceiptDocTypeCodeEnum.values();
        for (IssueReceiptDocTypeCodeEnum obj : arrObj) {
            // 将厂内领料转化为生产领料
            docTypeName = docTypeName.replaceAll("厂内", "生产");
            if (obj.name().contains(docTypeName.substring(0,6))) {
                return obj.getDocTypeCode();
            }
        }
        return "";
    }

}
